#!/bin/bash

# This script is a convenience script that copies this master "frontstart.inc.php"
# to all other project directories that contain a copy of the file.

cd ../..

find $(ls | grep -v '.-') -name frontstart.inc.php -print | grep '^[a-z-]*/' | grep -v '/front-framework/' | sed -e 's!/frontstart.inc.php$!!' |
while read DIR
do
    if diff sitefront/front-framework/frontstart.inc.php $DIR/frontstart.inc.php > /dev/null 2>&1
    then
        echo "Checking  $DIR/frontstart.inc.php ... no changes."
    else
        echo "Replacing $DIR/frontstart.inc.php"
        cp sitefront/front-framework/frontstart.inc.php $DIR/frontstart.inc.php
    fi
done

ls /www/*/env/*/apps/*/frontstart.inc.php | sed -e 's!/frontstart.inc.php$!!' |
while read DIR
do
    if diff sitefront/front-framework/frontstart.inc.php $DIR/frontstart.inc.php > /dev/null 2>&1
    then
        echo "Checking  $DIR/frontstart.inc.php ... no changes."
    else
        echo "Replacing $DIR/frontstart.inc.php"
        cp sitefront/front-framework/frontstart.inc.php $DIR/frontstart.inc.php
    fi
done

